package com.ebo.kline.listener;

import android.content.Context;
import android.widget.TextView;

import com.ebo.commonlib.utils.DigitUtils;
import com.ebo.kline.KConfig;
import com.ebo.kline.model.IKData;
import com.ebo.kline.view.ChartInfoView;
import com.github.mikephil.charting.charts.Chart;

import java.util.List;

/**
 * Created by admin on 2018/5/30.
 */

public class SubInfoViewListener extends InfoViewListener {

    public SubInfoViewListener(Context context, double lastClose, List<IKData> list, ChartInfoView infoView) {
        super(context, lastClose, list, infoView);
    }

    public SubInfoViewListener(Context context, double lastClose, List<IKData> list, ChartInfoView infoView, Chart otherChart) {
        super(context, lastClose, list, infoView, otherChart);
    }

    public SubInfoViewListener(Context context, double lastClose, List<IKData> list, ChartInfoView infoView, TextView descView, Chart otherChart) {
        super(context, lastClose, list, infoView, descView, otherChart);
    }

    private String color;

    @Override
    public void setConfig(KConfig config) {
        super.setConfig(config);
        color = config.volcolorhex;
    }


    @Override
    protected String getDesc(int position){
        StringBuilder desc = new StringBuilder("");
        desc.append("<font color=\"");
        desc.append(color);
        desc.append("\">");
        desc.append("VOL:");
        desc.append(DigitUtils.doublestr(mList.get(position).getVolume(),2));
        desc.append("</>");
        return desc.toString();
    }


}
